#include<iostream>
#include<vector>
#include<array>

using namespace std;

struct student_info{
    string name;
    int age;
    string* hobby;
};


void f1(){
    student_info s1;
    student_info *s2 = new student_info;    // 不分配空间，下面赋值会报错
    s1.name = "小米";
    s1.age = 18;
    s1.hobby = new string("读书");
    cout << s1.name << "今年" << s1.age << "了，喜欢" <<  *(s1.hobby) << endl;


    s2->name = "小红";
    s2->age = 19;
    s2->hobby = new string("睡觉");
    cout << s2->name << "今年" << s2->age << "了，喜欢" <<  *(s2->hobby) << endl;

    delete s1.hobby;
    delete s2;
}


void f2(){
    vector<int> v1 = {1,2,3};
    cout << "v1的元素个数是" << v1.size() << endl;  // v1的元素个数是3
    
    for(int i = 0; i < v1.size(); i++){
        cout << "v1[" << i << "] = " << v1[i] << "\n";
    }

    vector<int> v2(3);
    v2 = v1;
    cout << "v2的元素个数是" << v2.size() << endl;  // v1的元素个数是3
    for(int i = 0; i < v2.size(); i++){
        cout << "v2[" << i << "] = " << v2[i] << "\n";
    }
    
}


int main(int argc, char** argv){
    f2();
    

    return  0;
}